package view;

import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import controller.CreateKundeAction;

public class LastView extends JPanel implements PropertyChangeListener{

	private CreateKundeAction action;
	private JLabel jLabel;
	
	public LastView(){
		super();
		setBorder(BorderFactory.createTitledBorder("Letzter Kunde"));
		action = new CreateKundeAction();
		action.getKundenList().addPropertyChangeListener(this);
		jLabel = new JLabel();
		add(jLabel, BorderLayout.CENTER);	
	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		if(evt.getPropertyName().equals("KUNDE_ADD")){
			jLabel.setText(evt.getNewValue().toString());
		}
		
	}
}
